﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DataModel
{
    public class BillItem
    {
        public DishType dishType { get; set; }
        public string categoryName { get; set; }
        public string dishName { get; set; }
        //套餐用
        public List<string> comboDishes { get; set; }

        //自选菜用
        public List<string> options { get; set; }

        public BillItem()
        {
            dishType = DishType.None;
            categoryName = string.Empty;
            dishName = string.Empty;
            comboDishes = new List<string>();
            options = new List<string>();
        }

        public string DisplayName { get; set; }
        public decimal Price { get; set; }
        public decimal getPrice()
        {
            switch (dishType)
            {
                case DishType.FixedDish:
                    {
                        break;
                    }
                case DishType.Replaceable:
                    {
                        break;
                    }
                case DishType.Combo:
                default:
                    {
                        break;
                    }
            }
            Price = 0.0M;
            return Price;
        }

        public string getDishplayName()
        {
            StringBuilder disName = new StringBuilder(dishName);
            if (this.dishType == DishType.Combo)
            {
                disName.Append("(" + comboDishes[0]);
                for (int i = 1; i < comboDishes.Count; i++)
                {
                    disName.Append(", " + comboDishes[i]);
                }
                disName.Append(")");
                DisplayName = disName.ToString();
                return DisplayName;
            }
            else if (this.dishType == DishType.Replaceable)
            {
                if (options.Count > 0)
                {
                    disName.Append("(" + options[0]);
                    for (int i = 1; i < options.Count; i++)
                    {
                        disName.Append(", " + options[i]);
                    }
                    disName.Append(")");
                }
                DisplayName = disName.ToString();
                return DisplayName;
            }
            else
            {
                DisplayName = disName.ToString();
                return DisplayName;
            }
        }
    }
}
